<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
    <div id="main" style="width: 600px;height:400px;"></div>
    <script src="../echarts.min.js"></script>
    <script>
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        // 指定图表的配置项和数据
        var option = {
            xAxis: {
                data: ['Jun', 'Jul', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC', 'JAN'],
                axisLine: {
                    show: false
                },
                axisTick: {
                    show: false
                },
                splitLine: {
                    show: false
                },
                axisLabel: {
                    color: '#BDCADB',
                    rotate: 90
                }

            },
            yAxis: {
                axisLine: {
                    show: false
                },
                axisTick: {
                    show: false
                },
                splitLine: {
                    show: false
                },
                axisLabel: {
                    color: '#3B3B4D',

                }

            },
            series: [{
                type: 'bar',
                barWidth: 30,
                data: [1, 2, 3, 4, 5, 6, 7, 8],
                itemStyle: {
                    color: function (params) {
                        // var colorList = ['#4048EF', '#F15887', '#4048EF', '#4048EF', '#4048EF']
                        var _index = params.dataIndex
                        // return colorList[_index]
                        var colorList = [{
                            top: '#4048EF',
                            bottom: '#5A7BEF'
                        }, {
                            top: '#FE9B86',
                            bottom: '#FE9B86'
                        }, {
                            top: '#FE9B86',
                            bottom: '#FE9B86'
                        }, {
                            top: '#2DC9EB',
                            bottom: '#14D2B8'
                        }, {
                            top: '#B0E881',
                            bottom: '#72F7C5'
                        }, {
                            top: '#645AFF',
                            bottom: '#A573FF'
                        }, {
                            top: '#4048EF',
                            bottom: '#5A7BEF'
                        }, {
                            top: '#645AFF',
                            bottom: '#A573FF'
                        }]
                        return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: colorList[_index].top
                        }, {
                            offset: 1,
                            color: colorList[_index].bottom

                        }], false)
                    }
                }
            }, {
                type: 'pictorialBar',
                data: [1, 2, 3, 4, 5, 6, 7, 8],
                itemStyle: {
                    color: '#fff'
                },
                silent: false,
                symbol: 'rect',
                symbolMargin: 5,
                symbolPosition: 'start',
                symbolRepeat: true,
                symbolSize: [30, 10]
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>

</html>